package cn.bdqn.mh.vo;



import cn.bdqn.mh.pojo.Article;
import cn.bdqn.mh.pojo.Category;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ArticleVO {
    private Integer id;
    @NotBlank(message = "标题不能为空")
    private String title;
    @NotBlank(message = "摘要不能为空")
    private String description;
    @NotBlank(message = "正文不能为空")
    private String body;
    @NotBlank(message = "作者不能为空")
    private String author;
    private String smallImg;
    private Integer createdBy;
    private Date createDate;
    private Integer categoryId;
    //导航属性
    private Category Category;

    public ArticleVO(Article article){
        this.id=article.getId();
        this.title=article.getTitle();
        this.author=article.getAuthor();
        this.description=article.getDescription();
        this.body=article.getBody();
        this.smallImg=article.getSmallImg();
        this.categoryId=article.getCategoryId();
    }
}
